/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package lyra;

import java.awt.Dimension;
import java.awt.Toolkit;
/**
 *
 * @author Marmaridis, Mariolou, Koustas
 */
public class mainForm extends javax.swing.JFrame {

     FListArtist fListArtist;
     FListMusicGroup fListMusicGroup;
     FListMusicGroupAlbum fListMusicGroupAlbum;
     FListArtistAlbum fListArtistAlbum;
     FListPlayList fListPlayList;
             
    /**
     * Creates new form mainForm
     */
    public mainForm() {
        initComponents();
        
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
        int left = (d.width - this.getWidth()) / 2;
        int top = (d.height - this.getHeight()) / 2;        
        this.setLocation(left, top);
    }
    
    public void EnableDisableMenu(boolean enable) {
        mnuMenu.setEnabled(enable);
        mnuArtAlbum.setEnabled(enable);
        mnuArtist.setEnabled(enable);
        mnuBandAlbum.setEnabled(enable);
        mnuBands.setEnabled(enable);
        mnuManage.setEnabled(enable);
        mnuSongs.setEnabled(enable);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        desktop = new javax.swing.JDesktopPane();
        jLabel1 = new javax.swing.JLabel();
        mnuMenu = new javax.swing.JMenuBar();
        mnuManage = new javax.swing.JMenu();
        mnuArtist = new javax.swing.JMenuItem();
        mnuBands = new javax.swing.JMenuItem();
        mnuBandAlbum = new javax.swing.JMenuItem();
        mnuArtAlbum = new javax.swing.JMenuItem();
        mnuSongs = new javax.swing.JMenu();
        mnuExit = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("ΛΥΡΑ - Λογισμικό Υποστήριξης ΡΑδιοφωνίας");
        setName("mainForm"); // NOI18N

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/lyra.gif"))); // NOI18N

        javax.swing.GroupLayout desktopLayout = new javax.swing.GroupLayout(desktop);
        desktop.setLayout(desktopLayout);
        desktopLayout.setHorizontalGroup(
            desktopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, desktopLayout.createSequentialGroup()
                .addContainerGap(754, Short.MAX_VALUE)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        desktopLayout.setVerticalGroup(
            desktopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, desktopLayout.createSequentialGroup()
                .addContainerGap(341, Short.MAX_VALUE)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 306, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        desktop.setLayer(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        mnuManage.setText("1. Διαχείριση αρχείων");
        mnuManage.setActionCommand("manageFiles");

        mnuArtist.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_K, java.awt.event.InputEvent.ALT_MASK));
        mnuArtist.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/microphone20.png"))); // NOI18N
        mnuArtist.setText("a. Καλλιτέχνες");
        mnuArtist.setActionCommand("manageArtists");
        mnuArtist.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuArtistActionPerformed(evt);
            }
        });
        mnuManage.add(mnuArtist);

        mnuBands.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
        mnuBands.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/WindowsGroups_7309.png"))); // NOI18N
        mnuBands.setText("b. Συγκροτήματα");
        mnuBands.setActionCommand("manageBands");
        mnuBands.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuBandsActionPerformed(evt);
            }
        });
        mnuManage.add(mnuBands);

        mnuBandAlbum.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.ALT_MASK));
        mnuBandAlbum.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/AudioCD20.png"))); // NOI18N
        mnuBandAlbum.setText("c. Άλμπουμ Συγκροτημάτων");
        mnuBandAlbum.setActionCommand("manageAlbumBands");
        mnuBandAlbum.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuBandAlbumActionPerformed(evt);
            }
        });
        mnuManage.add(mnuBandAlbum);

        mnuArtAlbum.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.ALT_MASK));
        mnuArtAlbum.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/AudioCD20.png"))); // NOI18N
        mnuArtAlbum.setText("d. Άλμπουμ καλλιτεχνών");
        mnuArtAlbum.setActionCommand("manageAlbumArtists");
        mnuArtAlbum.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuArtAlbumActionPerformed(evt);
            }
        });
        mnuManage.add(mnuArtAlbum);

        mnuMenu.add(mnuManage);

        mnuSongs.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/playlist20.png"))); // NOI18N
        mnuSongs.setText("2. Λίστες Τραγουδιών");
        mnuSongs.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnuSongsMouseClicked(evt);
            }
        });
        mnuSongs.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuSongsActionPerformed(evt);
            }
        });
        mnuMenu.add(mnuSongs);

        mnuExit.setText("3. Έξοδος");
        mnuExit.setName("mnuExit"); // NOI18N
        mnuExit.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnuExitMouseClicked(evt);
            }
        });
        mnuExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuExitActionPerformed(evt);
            }
        });
        mnuMenu.add(mnuExit);

        setJMenuBar(mnuMenu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(desktop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktop, javax.swing.GroupLayout.Alignment.TRAILING)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void mnuArtistActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuArtistActionPerformed
        if ((fListArtist == null) || (fListArtist.isClosed() )) {
            fListArtist = new FListArtist(desktop, this);
            desktop.add(fListArtist);
            fListArtist.setVisible(true);
        } 
    }//GEN-LAST:event_mnuArtistActionPerformed

    private void mnuBandAlbumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuBandAlbumActionPerformed
        if ((fListMusicGroupAlbum == null) || (fListMusicGroupAlbum.isClosed() )) {
            fListMusicGroupAlbum = new FListMusicGroupAlbum(desktop, this);
            desktop.add(fListMusicGroupAlbum);
            fListMusicGroupAlbum.setVisible(true);
        } 
    }//GEN-LAST:event_mnuBandAlbumActionPerformed

    private void mnuBandsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuBandsActionPerformed
        if ((fListMusicGroup == null) || (fListMusicGroup.isClosed() )) {
            fListMusicGroup = new FListMusicGroup(desktop, this);
            desktop.add(fListMusicGroup);
            fListMusicGroup.setVisible(true);
        }
     }//GEN-LAST:event_mnuBandsActionPerformed

    private void mnuArtAlbumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuArtAlbumActionPerformed
        if ((fListArtistAlbum == null) || (fListArtistAlbum.isClosed() )) {
            fListArtistAlbum = new FListArtistAlbum(desktop, this);
            desktop.add(fListArtistAlbum);
            fListArtistAlbum.setVisible(true);
        }
    }//GEN-LAST:event_mnuArtAlbumActionPerformed

    private void mnuSongsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSongsActionPerformed
        if (mnuSongs.isEnabled()) {
            if ((fListPlayList == null) || (fListPlayList.isClosed() )) {
                fListPlayList = new FListPlayList(desktop, this);
                desktop.add(fListArtistAlbum);
                fListPlayList.setVisible(true);
            } 
        }
    }//GEN-LAST:event_mnuSongsActionPerformed

    private void mnuSongsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnuSongsMouseClicked
        if (mnuSongs.isEnabled()) {
            if ((fListPlayList == null) || (fListPlayList.isClosed() )) {
                fListPlayList = new FListPlayList(desktop, this);
                desktop.add(fListPlayList);
                fListPlayList.setVisible(true);
            } 
        }
    }//GEN-LAST:event_mnuSongsMouseClicked

    private void mnuExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExitActionPerformed
        finis();
    }//GEN-LAST:event_mnuExitActionPerformed

    private void mnuExitMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnuExitMouseClicked
        finis();
    }//GEN-LAST:event_mnuExitMouseClicked

//    /**
//     * @param args the command line arguments
//     */
//    public static void main(String args[]) {
//        /* Set the Nimbus look and feel */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
//         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(mainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(mainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(mainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(mainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>
//
//        /* Create and display the form */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                new mainForm().setVisible(true);
//            }
//        });
//    }
    
    private void finis()
    {
      dispose();  
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDesktopPane desktop;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenuItem mnuArtAlbum;
    private javax.swing.JMenuItem mnuArtist;
    private javax.swing.JMenuItem mnuBandAlbum;
    private javax.swing.JMenuItem mnuBands;
    private javax.swing.JMenu mnuExit;
    private javax.swing.JMenu mnuManage;
    private javax.swing.JMenuBar mnuMenu;
    private javax.swing.JMenu mnuSongs;
    // End of variables declaration//GEN-END:variables
}
